#include<stdio.h>
int main(void)
{
    double Height=0.0;
    int n,i;
    char c;
    scanf("%d\n",&n);

    for(i=0;i<n;i++){
        scanf("%c %lf\n",&c,&Height);
        if(c=='M'){
            printf("%.2lf\n",Height/1.09);
        }   if(c=='F'){
                printf("%.2lf\n",Height*1.09);
            }
        
    }


    return 0;
    


}